import axios from "axios";

const state = {
    content:[],
}

const mutations = {
    CHANE_CONTENT(state, content){
        // console.log(1,content)
        state.content=content; 
    }
}

const actions ={

    async addContent({commit}, params){
        // console.log(params)
        await axios.post("/addContent",params)
    }, 
    async getAddContent({commit}, {pageIndex=1}){
       const data= await axios.get("/askForLeaveList",{
           params:{
                pageIndex
           }
       })
        // console.log(data)
        commit("CHANE_CONTENT",data.data)
        // console.log(data.data)
    },
    async upStatus({commit}, params){
        // console.log(params)
        const {id,status}=params
        await axios.put("/upStatus/"+id+"/"+status)
    }
}

export default {
    state,
    actions,
    mutations
}